from vanna.remote import VannaDefault
from influxdb import InfluxDBClient
from vanna.flask import VannaFlaskApp

vn = VannaDefault(model='goudan', api_key='d1734f62731a473a8b37a260fe1c4d9c')
vn.connect_to_mysql(host='10.240.53.162',
                    dbname='test',
                    user='rdsroot',
                    password='Geely@db20211206',
                    port=3306)
vn.train(ddl="""
CREATE TABLE IF NOT EXISTS users (
    id INT PRIMARY KEY COMMENT '用户ID'， 
    username VARCHAR(50) COMMENT '用户名'， 
    email VARCHAR(100) COMMENT '电子邮件'， 
    age INT COMMENT '年龄'， 
    gender VARCHAR(10) COMMENT '性别（男/女）'， 
    city VARCHAR(50) COMMENT '城市'
) COMMENT='用户信息表' CHARACTER SET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
""")
# vn.ask('What are the top 10 employees to create?')

VannaFlaskApp(vn).run()
